package com.youbug.kefu.controller;


import cn.hutool.crypto.symmetric.AES;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.youbug.kefu.entity.ServiceTicket;
import com.youbug.kefu.entity.User;
import com.youbug.kefu.service.IServiceTicketService;
import com.youbug.kefu.service.IUserService;
import com.youbug.kefu.vo.R;
import com.youbug.kefu.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 服务单表 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2023-01-08
 */
@RestController
@RequestMapping("/online")
public class OnlineController {

    @Autowired
    private IServiceTicketService serviceTicketService;


    @GetMapping("/getServiceTicket/{id}")
    public R<ServiceTicket> getUser(@PathVariable Long  id){

        ServiceTicket ticket = serviceTicketService.getById(id);

        return R.ok(ticket);
    }

    @PostMapping("/addTicket")
    public R<ServiceTicket> add(@RequestBody ServiceTicket ticket){

        boolean save = serviceTicketService.save(ticket);

        return  R.ok(ticket);
    }

    @PostMapping("/updateTicket")
    public R<Boolean> update(@RequestBody ServiceTicket ticket){

        boolean save = serviceTicketService.updateById(ticket);

        return  R.ok(save);
    }

    @GetMapping("/signIn")
    public R<Boolean> signIn(){


        return  R.ok(true);
    }
    @GetMapping("/signOut")
    public R<Boolean> signOut(){


        return  R.ok(true);
    }

    @GetMapping("/ready")
    public R<Boolean> ready(){


        return  R.ok(true);
    }

    @GetMapping("/rest")
    public R<Boolean> rest(){

        return  R.ok(true);
    }


}

